// EventBus.js
const EventBus = {};
EventBus.$on = function (event, callback) {
  if (!this.events) {
    this.events = {};
  }
  (this.events[event] || (this.events[event] = [])).push(callback);
};
EventBus.$emit = function (event, data) {
  if (this.events && this.events[event]) {
    this.events[event].forEach(callback => callback(data));
  }
};
EventBus.$off = function (event) {
  if (this.events) {
    delete this.events[event];
  }
};
module.exports = EventBus;